<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require '../com.swiss.mooh.dao.impl/FileDaoImpl.php';
require '../com.swiss.mooh.service/FileContentServiceImpl.php';


$dispatcher = new FileDaoImpl();
$fileContentService = new FileContentServiceImpl($dispatcher);

$output_dir = "../../assets/images/uploads/files/";
$listOfFileVO = $fileContentService->getAllFileContentByDescID("");
if ($listOfFileVO->Size() <= 0) {
    echo 200;
} else {
    for ($i = 0; $i < $listOfFileVO->Size(); $i++) {
        $fileName = $listOfFileVO->GetObj($i)->getFileName();
        $filePath = $output_dir . $fileName;
        if (file_exists($filePath)) {
            unlink($filePath);
            $res = $fileContentService->deleteAllFileTemp();
            echo $res;
        }
    }
}

